package com.gxgeek.order.message;

import com.gxgeek.order.dto.OrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

import static com.gxgeek.order.message.StreamClient.INPUT;
import static com.gxgeek.order.message.StreamClient.INPUT2;

/**
 * @author gaoxing
 * @create 2018-03-28 下午4:30
 */
@Slf4j
@Component
@EnableBinding(StreamClient.class)
public class StreamReceiver {
//    @StreamListener("myMessage")
//    public void message(Object message){
//      log.info("StreamReceiver Message:{} ",message);
//    }


    @StreamListener(INPUT)
    @SendTo(INPUT2)
    public String message(String message){
      log.info("StreamReceiver Message:{} ",message);
        return "reveived.";
    }

    @StreamListener(INPUT2)
    public void proess2(String message){
      log.info("StreamReceiver2 Message:{} ",message);
    }
}
